home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group96a.txt
/
000008_icon-group-sender _Sat Jan 6 01:50:00 1996.msg
< prev
next >
Wrap
Internet Message Format
|
1996-09-05
|
8KB
Received: by cheltenham.cs.arizona.edu; Mon, 8 Jan 1996 06:10:07 MST
Message-Id: <m0tYTO4-001HkyC@ns1.computek.net>
Date: Sat, 6 Jan 96 01:50 CST
Mime-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
From: gep2@computek.net
Subject: Re: How does Icon compare to Perl?
To: icon-group@cs.arizona.edu
X-Mailer: SPRY Mail Version: 04.00.06.17
Errors-To: icon-group-errors@cs.arizona.edu
Status: O
>This is the 165423109 posting of Gordon Peterson on this issue. WE KNOW ALL
that Gordon hates Perl and loves Icon. That is perfectly alright! But it starts
to be really boring.
There is a simple solution to having my messages represent such a high
percentage of all postings. Post more actively yourself!!! As you've noticed,
the original poster asked how Icon compared to Perl in terms of text handling
capabilities. I've not seen a huge number of replies, and I didn't want the
question to go unanswered!!!
>Could Gordon add at least once a serious argument in favour
of his standpoint??!
You know, the Icon book (highly recommended) is chock-full of wonderful examples
of the things that Icon does better than other languages. And indeed, the Icon
Program Library contains hundreds of large and small routines and programs that
are similarly instructive. So it's not as if anybody who's seriously interested
doesn't have LOADS of resources to show them copious examples of programs, most
of which you'd have a much harder time trying to implement in Perl.
>I tried to exchange some private letters with Gordon,
I -always- return replies to such letters, but don't recall seeing yours.
>but I still don't know the reason of his personal, partisan attitude.
I believe I explained it here, more than once. I had a friend in Paris who was
very excited about Perl. I asked him for a choice example of one of his Perl
applications, to show me why Perl was so wonderful, and I rewrote it (with very
little effort... and better, more tolerant, more flexible, and more robust) in
SNOBOL4+ in roughly half the lines, half the bytes, and half the statements of
source code.
What is it about that that you don't understand?
>I know why I like Icon. I enjoy the functional 'visage' of the language and
I appreciate in general the generators and co-expressions, as the
non-determinism is a sine-qua-non methodology for the artificial intelligence.
>I like Perl because I learned it before I knew Python and I had to write some
really lousy CGI scripts. In my opinion the languages ARE comparable.
I don't see how you can claim that. I believe that just about anything you
could write in Perl could be easily written in either Icon or SNOBOL4+ (with
only perhaps a few minor addons to access specific low-level system functions),
but I don't believe that the converse is true.
>Icon is a well structured procedural language, Perl is $horrible, but it has
been built to deal in a simple manner with regexps.
That's just grand, except that regexps are a "poor man's SNOBOL4-pattern
substitute", implemented in classical (and still godawful) UNIX/Teletype
control-characters-do-everything style. If you like regexps, then you're
certainly welcome to them... but I consider them a pitiful excuse for
full-fledged SNOBOL4 patterns.
>This is rather a question of style than of the brute power. All this was
discussed here several times. Perhaps we could write one day a decent
comparison-FAQ instead of posting slogans.
You know, it's really rather like food. Some people really do not have anything
like a gourmet palate... for them, absolutely anything that fills the gnawing
hole in their midsection will do them just fine. And perhaps, for them, going
anywhere to eat that's fancier than McDonald's or Sizzler is really just a waste
of money. On the other hand, if you are sufficiently discerning to appreciate
the difference, there really is a world of difference between a Big Mac and a
really excellent dinner.
I got into a really long debate once in an Intelec BBS conference with a moron
who claimed that "Anything you can do in SNOBOL4+, I can write just as easily
and quickly in PDS Basic". (Yeah, RIIIIIIGGHTT!!!)
So I proposed a programming challenge (actually, this was not the first such
challenge we proposed in that conference, although this was certainly the most
interesting one). I uploaded to a commonly-accessible BBS a file I'd collected
containing something like 20,000 lines from BBS messages. These lines contained
normal unformatted message text, sig lines, taglines, price listings, computer
model numbers and codes, FIDOnet node addresses, occasional E-mail addresses,
ANSI graphics, header lines, and the like. The messages originated from authors
in various countries around the world (but were all written in English or
French, at least). The programming assignment was to write a program which
would extract from this file, and write to an output file, all the complete
postal addresses and telephone numbers (name, street or PO Box address, county
or district (in England for example), city, state if any, postal code, country,
and (maybe) phone number) that were to be found in the input file. Of course,
addresses in the USA, Canada, England, Germany, Italy, France and the like don't
really look very much alike (both in terms of data values, and how they are
typically formatted overall), but all needed to be recognized by the program
(and programs earned demerits if they recognized things as postal addresses that
clearly (to a human, at least) were not).
I designed and implemented (and posted) a program in SNOBOL4+ which met the
established criteria. Needless to say, the other fellow never did. :-)
>We have to gather some serious questions first, for example:
>How important for you are modern control structures? (If not at all, use
Snobol4...)
So-called "modern" control structures are one paradigm for expressing
algorithms, but they are certainly not the only practical or effective one. For
example, as the Icon book mentions, the statement
(open(file) | write("Can't open the file!"))
is every bit as clear as (and more compact than) the more classical IF-THEN
statement.
Perhaps a more interesting real-world example is a piece of code which one finds
in more or less comparable form in nearly every one of my SNOBOL4+ programs.
The code is like the below:
SCREEN = "Sorry, I cannot open the "
+ (~INPUT(.INPUT,5,"R,300") "input text file, unit 5.",
+ ~OUTPUT(.OUTPUT,6,"W,300") "output text file, unit 6.",
+ ~OUTPUT(.LOG,8,"W,E,300","LOG.TXT") "output file LOG.TXT.")
+ :S(END)
Certainly this does not use the so-called "modern" IF-THEN control structure,
but if you try to implement the same functionality as I get using the above with
the "modern control structures" that you apparently find so wonderful in other
languages, I think you'll have a hard time showing how these so-called "modern"
control structures do a better job.
Of course, as in the case of McDonald's, some people really don't have the
imagination or intellectual drive to want to learn alternative ways of thinking
about problems. For them, the clockwork-style "knit-one-perl-two" of classical
primitive control structures may better fit their personal and intellectual
style. :-)
Gordon Peterson
http://www.computek.net/public/gep2/